<?php

declare(strict_types=1);

/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

use Hyperf\HttpServer\Router\Router;
use App\Middleware\ApiSign;
use App\Controller\Api\Notify\PaymentController;
use App\Controller\Api\v1\DemoController;
use App\Controller\Api\v1\WechatController;

// 该 Group 下的所有路由都将应用配置的中间件
Router::addGroup('/notify', function () {
    Router::post('/payment/wechat', [PaymentController::class, 'wechat']);
});
/**
 * Version 1.0
 */
Router::addGroup('/v1', function () {
    Router::addRoute(['GET','POST'],'/demo', [DemoController::class, 'index']);

    // 微信示例
    Router::addGroup('/wechat', function () {
        Router::post('/miniAppCode', [WechatController::class, 'miniAppCode']);// 小程序code
        Router::post('/miniAppPhone', [WechatController::class, 'miniAppPhone']);// 小程序手机号
        Router::post('/miniAppPay', [WechatController::class, 'miniAppPay']);// 小程序支付
    });

    // 需登录
    Router::addGroup('/auth', function () {

    }, ['middleware' => [ApiSign::class]]);
});